<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>显示迭代.html</title>
    <script src="js/jquery-3.6.3.js"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
            list-style: none;
            box-sizing: border-box;
            text-decoration: none;
        }

        .clearfix::after {
            content: "";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }

        .content {
            width: 430px;
            margin: 0 auto;
            background-color: darkgrey;
        }

        .list li {
            margin-right: 10px;
            width: 100px;
            height: 100px;
            float: left;
            background-color: greenyellow;
            margin-top: 10px;
        }

        .list li:last-of-type, .list li:nth-of-type(4) {
            margin-right: 0;
        }

    </style>
</head>
<body>
<div class="content clearfix">
    <ul class="list">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</div>
</body>
<script>
    $(function () {
        $('.list>li').each(function (index, element) {
            $(element).css('opacity', (index + 1) / 10)
        })
    })

</script>
</html>